package com.jinx.domain;

import lombok.AllArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Jinx
 * @date 2021/7/30 5:49 下午
 */
@AllArgsConstructor
public enum Impression {

    LOVE("love", "喜欢"),
    FUNNY("funny", "有趣"),
    HATE("hate", "讨厌");

    private final String value;
    private final String desc;

    public String value(){
        return this.value;
    }


    private final static List<Impression> impressions = new ArrayList<Impression>(3){
        {
            add(Impression.HATE);
            add(Impression.LOVE);
            add(Impression.FUNNY);
        }
    };


    public static Impression select(String value){
        for (Impression impression : impressions) {
            if(impression.value.equals(value)){
                return impression;
            }
        }

        throw new UnsupportedOperationException("Impression 不支持的value:" + value);
    }
}
